/**
 * 
 */
package org.youisoft.summer.spring;

/**
 * 
 */

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.youisoft.summer.evaluator.eval.ExpressionEvaluator;

/**
 * @author zijiang.jl
 *
 */
public class EvaluatorPostProcessor implements BeanPostProcessor {
	
	private ExpressionEvaluator<?,?,?> evaluator;

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName)
			throws BeansException {
		
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName)
			throws BeansException {
		evaluator.register(beanName, bean);
		return bean;
	}

	public final ExpressionEvaluator<?,?,?> getEvaluator() {
		return evaluator;
	}

	public final void setEvaluator(ExpressionEvaluator<?,?,?> evaluator) {
		this.evaluator = evaluator;
	}

}

